use napi_derive_ohos::napi;

/// 模拟消息结构体
struct Message {
    content: String,
    timestamp: u64,
}

/// 发送消息的内部实现
fn send_message_internal(msg: Message) {
    println!("发送消息内容: {}", msg.content);
    println!("发送消息时间戳: {}", msg.timestamp);
}

/// 对外暴露的接口
/// timestamp 使用 f64 传入，内部转换成 u64
#[napi]
pub fn send_message(content: String, timestamp: f64) {
    let ts = timestamp as u64;
    let msg = Message {
        content,
        timestamp: ts,
    };
    send_message_internal(msg);
}

